{extend name='extra@admin/content'} {block name="button"}
<div class="nowrap pull-right" style="margin-top:10px">
    <button class="layui-btn layui-btn-danger layui-btn-small" type='button' data-open='{:url("$classuri/index")}'>取消编辑</button>
</div>
{/block} {block name='content'}
<form class="form-horizontal" role="form" onsubmit="return false;">

    <div class="layui-form-item">
        <label class="layui-form-label">单页标题</label>
        <div class="layui-input-block">
            <input type="text" name="title" value="{$vo.title|default=''}" class="layui-input" readonly="readonly">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">单页简介</label>
        <div class="layui-input-block">
            <textarea name="desc" placeholder="请输入单页简介" class="layui-textarea">{$vo.desc|default=''}</textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">单页大图</label>
        <div class="layui-input-block">
            <div class="row nowrap">
                <div class="col-xs-3" style="width:160px;">
                    <div class="upload-image-box transition" >
                        <input value="" type="hidden" name="pic">
                    </div>
                </div>
                <div class="col-xs-6">
                    <br>
                    <a data-file="one" data-type="jpg,png,jpeg" data-field="pic" class="btn btn-sm">上传图片</a>
                </div>
            </div>
            <p class="help-block" style="margin-top:10px;color:#ccc">封面大图片建议尺寸：200像素 * 200像素</p>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">单页内容</label>
        <div class="layui-input-block">
            <textarea name='content'>{$vo.content|default=''}</textarea>
        </div>
    </div>

    <div class="hr-line-dashed"></div>

    <div class="layui-form-item text-center">
        <!--{if isset($vo['id'])}-->
        <input type='hidden' value='{$vo.id}' name='id' />
        <!--{/if}-->
        <input type='hidden' value='{$vo.cid}' name='cid' />
        <input type='hidden' value='{$vo.type}' name='type' />
        <button data-submit class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-open='{:url("$classuri/index")}'>取消编辑</button>
    </div>

</form>

{/block}
{block name='script'}
<script>
    $(function () {
        var pic = '__PUBLIC__/static/plugs/uploader/theme/image.png';
        {if isset($vo['pic'])}pic = '{$vo.pic}';{/if}
        $('.upload-image-box input').val(pic);
        $('.upload-image-box input').parent('.upload-image-box').css('background-image', 'url(' + pic + ')');

        $('body').on('change', '.upload-image-box input', function () {
            $('.upload-image-box input').parent('.upload-image-box').css('background-image', 'url(' + this.value + ')');
        });

        require(['ueditor'], function () {
            /*! 实例富文本编辑器  */
            var editor;
            /*! 默认编辑图文 */
            editor = window.createEditor('[name="content"]', 'basic');
            /*! 编辑器初始化成功 */
            editor.ready(function () {
                var $form = $('form');
                $form.validate();
                /*! 数据提交 */
                $form.find('button[data-submit]').on('click', function () {
                    $.form.load('__SELF__', $form.serialize(), "post");
                });
            });
        });
    });
</script>
{/block}
{block name="style"}
<style>
    .upload-image-box{width:130px;height:90px;background-size:cover;background-position:center center;border:1px solid rgba(125,125,125,0.1);margin:5px}
</style>
{/block}